package com.wn.demo06;

import java.util.HashMap;
import java.util.concurrent.Executor;
import java.util.function.BiFunction;
import java.util.function.Supplier;

/**
 * @author yellow Docter
 * @date 2024 -06-18
 * @desc
 *    构造器的引用
 */
public class Demo04 {

    public static void main(String[] args) {

        //lambda表达式的写法
        Supplier<Emp> supplier1 = ()->new Emp();
        Emp emp = supplier1.get();
        System.out.println("emp = " + emp);

        //方法的引用 构造器的调用
        Supplier<Emp> supplier2 = Emp::new;
        Emp emp2 = supplier1.get();
        System.out.println("emp2 = " + emp2);

        //lambda表达式的写法 多参构造器的调用
        BiFunction<String,Integer,Emp> biFunction = (a,b) -> new Emp(a,b);
        Emp a1 = biFunction.apply("A", 23);
        System.out.println("a1 = " + a1);

        BiFunction<String,Integer,Emp> biFunction2 = Emp::new;
        Emp a2 = biFunction.apply("A", 23);
        System.out.println("a2 = " + a2);
    }
}
